<admintpl file="header" />
</head>
<body style="min-width: 800px;">
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="{:U('commentadmin/index')}">标签管理</a></li>
		</ul>
            <form class="well form-search" method="get" >
                <input type="hidden" name="g" value="admin" />
                    <input type="hidden" name="m" value="Tag" />
                    <input type="hidden" name="a" value="index" />
                    <input type="hidden" name="id" value="{$search.id}" />
			
			<input  class="btn btn-primary" onclick="add()"value="创建标签" type="button"/>
		</form>
		<form class="js-ajax-form" method="post">
			<table class="table table-hover table-bordered table-list">
				<thead>
					<tr>
						<th width="50">ID</th>
						<th width="100">标签名称</th>
                                                <th width="80">管理操作</th>
					</tr>
				</thead>
				<php>$status=array("1"=>L('AUDITED'),"0"=>L('NOT_AUDITED'));</php>
				<foreach name="list" item="vo">
				<tr>
					<td>{$vo.id}</td>
					<td>{$vo.tag_name}</td>
					<td>
                                            <a href="javascript:void(0);" onclick="edit({$vo.id})">修改</a> |
                                            <a href="{:U('Tag/delete',array('id'=>$vo['id']))}" class="js-ajax-delete">删除</a>
					</td>
				</tr>
				</foreach>
			</table>
			<div class="pagination">{$page}</div>
		</form>
	</div>
        <script src="__PUBLIC__/js/common.js"></script>
        <script>
	function edit(id){
			var dialog = art.dialog({
			title: '修改', content: '<table><tbody style=""><tr><td><textarea name="data" id="tag_name" style="width: 98%; height: 50px;" placeholder="请填写"></textarea></td></tr></tbody></table>',
			follow: document.getElementById('btn2'),
			ok: function(){
                            var url = '{:U('Tag/edit')}';
                            $.post(url, {'id': id,'tag_name':$("#tag_name").val()}, function (json)
                            {
                                if(json.state === 'success'){
                                            reloadPage(window);
                                            return false;
                                }
                                alert(json.info)
                                art.dialog.close();
                            });
                            return false;
                        }
                        });
	}
        
        	function add(){
			var dialog = art.dialog({
			title: '创建标签', content: '<table><tbody style=""><tr><td><textarea name="data" id="tag_name" style="width: 98%; height: 50px;" placeholder="请填写"></textarea></td></tr></tbody></table>',
			follow: document.getElementById('btn2'),
			ok: function(){
                            var url = '{:U('Tag/add')}';
                            if(!$("#tag_name").val()){
                                alert("标签名不能为空");
                                return false;
                            }
                            $.post(url, {'tag_name':$("#tag_name").val()}, function (json)
                            {
                                if(json.state === 'success'){
                                            reloadPage(window);
                                            return false;
                                }
                                alert(json.info)
                                art.dialog.close();
                            });
                            return false;
                        }
                        });
	}
        function add_batch(){
                var urlVal = 'http://126.com';
                art.dialog.open(urlVal, {
                width:'730px',
                height:'530px',
                title:"创建标签",
                });  
        }
</script>
</body>
</html>